#include <iostream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define LENGTH 50

int main()
{    
    char bar[LENGTH];
    int cnt = 0;
    memset(bar, '-', sizeof(bar));
    bar[LENGTH] = 0;
    std::string symbol = "/\\|-";
    while(1)
    {
        bar[cnt] = '#';
        cnt = cnt + 1;
        printf("[%s]  [%d%%]  [%c]\r", bar, cnt * 2, symbol[cnt % 4]);
        if(cnt >= LENGTH)
        {
            break;
        }
        bar[cnt] = '#';
        fflush(stdout);
        usleep(100000);
    }
    std::cout << std::endl << "Nothing to do!" << std::endl;
    return 0;
}
